
<include file="Common/header" />

<link rel="stylesheet" href="__PUBLIC__/css/orgnizerUserClass.css" type="text/css">
<link rel="stylesheet" href="__PUBLIC__/asset/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css">

<div class="app">

    <!-- top header -->
    <include file="Common/header_nav" />
    <!-- /top header -->

    <section class="layout">
        <!-- sidebar menu -->
        <include file="Common/left_aside" />
        <!-- /sidebar menu -->

        <!-- main content -->
        <section class="main-content">
            <header class="header navbar bg-default">
                <ul class="nav navbar-nav">
                    <li class="active">
                        <a href="#class" tabindex="-1" data-toggle="tab">查看用户所属组织</a>
                    </li>
                    <li >
                        <a href="/Home/Orgnizer/newquiz">生成团体测评</a>
                    </li>
                    <li id="quiz-result-li">
                        <a href="#quiz_result_pane" tabindex="-1" data-toggle="tab">查看测评结果</a>
                    </li>


                </ul>
            </header>
            <!-- content wrapper -->
            <div class="content-wrap">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade" id="home">
                        <div class="row">
                            <div class="col-md-8">
                                <div class="panel panel-success">
                                    <div class="panel-heading">生成测评</div>
                                    <div class="panel-body">
                                        <div class="row">
                                            <div class="col-xs-12">

                                            </div>
                                            <div class="col-xs-12">
                                                <form role="form" class="form-horizontal parsley-form" data-parsley-validate="" novalidate="">

                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">选择问卷</label>
                                                        <div class="col-xs-6" >
                                                            <div class="btn-group">
                                                                <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                                    选择类别 <span class="caret"></span>
                                                                </button>
                                                                <ul class="dropdown-menu">
                                                                    <li class="hidden-list"><a >初级量表</a></li>
                                                                    <li class="hidden-list"><a  >中剂量表</a></li>
                                                                    <li class="hidden-list"><a  >高级量表</a></li>

                                                                </ul>
                                                            </div><span>=></span>

                                                            <div class="btn-group">
                                                                <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                                    选择类别 <span class="caret"></span>
                                                                </button>
                                                                <ul class="dropdown-menu">

                                                                    <li class="hidden-list"><a >卡特尔16pf测试</a></li>

                                                                    <li class="hidden-list"><a  >卡特尔16pf测试</a></li>

                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">问卷人数</label>
                                                        <div class="col-sm-4">
                                                            <input type="number" class="form-control" name="firstname"  placeholder="填写数量" id="quiz_num">
                                                        </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">序列号</label>
                                                        <div class="col-sm-4">
                                                            <input type="text" class="form-control" name="lastname" data-parsley-required="true" data-parsley-trigger="change" placeholder="序列号（目前可选）" data-parsley-id="8986"><ul class="parsley-errors-list" id="parsley-id-8986"></ul>
                                                        </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">接收报告的邮箱</label>
                                                        <div class="col-sm-4">
                                                            <input type="text" class="form-control" name="country" data-parsley-required="true" data-parsley-trigger="change" placeholder="邮箱地址" data-parsley-id="1384"><ul class="parsley-errors-list" id="parsley-id-1384"></ul>
                                                        </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-sm-1 control-label"></label>
                                                        <div class="col-sm-4">
                                                            <a class="btn btn-primary btn-parsley" id="generate_quiz">生成测评</a>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>


                                            <div class="col-xs-12">
                                                <section class="panel">
                                                    <div class="panel-heading">测试链接</div>
                                                    <div class="panel-body no-padding">
                                                        <table class="table table-striped no-margin " >
                                                            <thead>
                                                            <tr>
                                                                <th class="col-md-2 pd-l-lg">
                                                                    <span class="pd-l-sm"></span>测试号</th>
                                                                <th class="col-md-2">测试序列号</th>
                                                                <th class="col-md-2">被测者</th>
                                                                <th class="col-md-2">链接</th>
                                                                <th class="col-md-2">操作</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody id="quizlist_tbody">
                                                            <tr>
                                                                <td>
                                                                    <span class="pd-l-sm"></span>Facebook</td>
                                                                <td>23,532</td>
                                                                <td>573</td>
                                                                <td>
                                                                    这里链接
                                                                </td>
                                                                <td><button class="btn btn-success btn-sm">复制链接</button></td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <span class="pd-l-sm"></span>Facebook</td>
                                                                <td>23,532</td>
                                                                <td>573</td>
                                                                <td>
                                                                    这里链接
                                                                </td>
                                                                <td><button class="btn btn-success btn-sm">复制链接</button></td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <span class="pd-l-sm"></span>Facebook</td>
                                                                <td>23,532</td>
                                                                <td>573</td>
                                                                <td>
                                                                    这里链接
                                                                </td>
                                                                <td><button class="btn btn-success btn-sm">复制链接</button></td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </section>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane " id="quiz_result_pane">
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                查看测试状态
                            </div>

                            <div class="panel-body">

                                <div class="row">
                                    <div class="col-md-10">
                                        <section class="panel">
                                            <div class="form-group">
                                                <label >点击选择组织测试的标题</label>
                                                <select class="form-control" id="quiz_title_select">
                                                    <option>读取中</option>

                                                </select>
                                            </div>

                                            <label>测试进度</label>
                                            <div class="panel-body no-padding">
                                                <table class="table table-striped no-margin" id="quiz_users_resulttable">

                                                </table>
                                            </div>
                                            <div class="panel-footer ">

                                                <div class="btn-group ">
                                                    <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">显示已完成用户集体报告
                                                        <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu" id="groupreport_list">
                                                        <li>
                                                            <a href="#">Dropdown link</a>
                                                        </li>
                                                        <li>
                                                            <a href="#">Dropdown link</a>
                                                        </li>
                                                    </ul>
                                                </div>


                                                <div class="btn-group ">
                                                    <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">下载集体报告
                                                        <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu" id="grouppdf_list">
                                                        <li>
                                                            <a href="javascript:;">Dropdown link</a>
                                                        </li>
                                                        <li>
                                                            <a href="javascript:;">Dropdown link</a>
                                                        </li>
                                                    </ul>
                                                </div>

                                                <a class="btn btn-danger" id="delete_grouptest_btn">删除这组测试</a>

                                            </div>
                                        </section>

                                    </div>


                                    <div class="col-md-6">
                                        <div class="panel">
                                            <div class="panel heading">
                                                预警设置
                                            </div>

                                            <div class="panel-body">
                                                <label>预警维度设置</label>

                                                <select class="form-controller" id="warnvalue_select">

                                                    <option>test1</option>
                                                    <option>test2</option>

                                                </select>


                                                <table class="table table-bordered table-striped responsive">
                                                    <thead>
                                                    <tr>
                                                        <th>指标</th>
                                                        <th>操作</th>
                                                        <th>值</th>

                                                    </tr>
                                                    </thead>

                                                    <tbody id="warn-set-list">


                                                    <foreach name="pf16_property" item="pf16">
                                                        <tr>
                                                            <td>{$pf16.property}</td>
                                                            <td><select>
                                                                <option>小于</option>
                                                                <option>大于</option>
                                                            </select></td>
                                                            <td><input type="number" id="{$pf16.section_name}"></td>
                                                        </tr>
                                                    </foreach>


                                                    </tbody>
                                                </table>

                                            </div>
                                            <div class="panel-footer">
                                                <a class="btn btn-success" id="commit-warnvalue">保存预警设置</a>
                                            </div>
                                        </div>
                                    </div>





                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane fade in active" id="class">
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                用户组织
                            </div>

                            <div class="panel-body">
                                <div class="row">

                                    <div class="col-md-3">
                                        <div class="row">
                                            <div class="col-lg-12">
                                                <form role="form" class="form-horizontal parsley-form" data-parsley-validate="" novalidate="">

                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label">团体名称</label>
                                                        <div class="col-sm-8">
                                                            <input type="text" class="form-control" placeholder="输入团队名称" id="org-name" value="" disabled>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>

                                            <div class="col-lg-12">

                                                <div class="cf nestable-lists">
                                                    <div class="dd" id="nestable">

                                                        <div class="edit-area">
                                                            <input type="text" class="form-control addclass"  placeholder="输入级别名称（如班级，部门名）" id="class-inputval"   /><a class="btn btn-primary btn-sm btn-parsley" id="submit-class" style="margin-top: 10px;">添加一级子级</a>
                                                        </div>
                                                    </div>


                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-9">
                                        <div class="row">
                                            <div class="col-lg-12">

                                                <a class="btn btn-success" id="save-classinfo">保存组织信息</a>
                                                <a class="btn btn-success" id="edit-classinfo">编辑组织信息</a>

                                                <pre id="nestable-output" style="display: none;"></pre>

                                                </a>


                                                <div class="col-xs-12" >
                                                    <section class="panel">
                                                        <div class="panel-heading">用户列表</div>
                                                        <div class="panel-body no-padding">

                                                            <div id="toolbar"></div>

                                                            <table class="table table-striped no-margin table-bordered" id="user-list-table">

                                                            </table>
                                                        </div>
                                                        <div class="panel-footer">
                                                            <div>
                                                                <a class="btn btn-success" id="add-user-btn">添加用户</a>
                                                                <div class="btn-group ">
                                                                    <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">从xls工作簿导入用户
                                                                        <span class="caret"></span>
                                                                    </button>
                                                                    <ul class="dropdown-menu" >
                                                                        <li>
                                                                            <a href="#">导入当前选择分组的用户</a>
                                                                        </li>
                                                                        <li>
                                                                            <a href="#" id="import-xls-all-btn">导入多个分组的用户</a>
                                                                        </li>
                                                                        <li>
                                                                            <a href="/d/importUsers_example.xls">下载多分组用户导入示例文件</a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                                <a class="btn btn-danger" id="delete-user">批量删除用户</a>

                                                            </div>

                                                            <form id= "uploadForm"   >
                                                                <input type="file" id="xls-upload-all" style="display:none;">
                                                            </form>

                                                            <!--<input type="file" id="xls-upload" style="display: none;">-->


                                                        </div>
                                                    </section>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                </div>
            </div>
            <!-- /content wrapper -->
                </div>
        </section>
        <!-- /main content -->
    </section>

</div>



<!-- 用户报告详细信息对话框 -->
<div class="modal fade" id="row_userquiz_info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-keyboard="false">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                详细信息
            </div>
            <div class="modal-body" >
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-body">
                            <form role="form">
                                <div class="form-group">
                                    <table class="table" id="user_quizstatus_detail">
                                        <thead>
                                            <tr>
                                                <td width="20%">测试名称</td>
                                                <td>进度</td>
                                                <td width="40%">操作</td>
                                            </tr>
                                        </thead>
                                        <tbody id="quiz_detail_modal_tbody">
                                            <tr>
                                                <td>名称名称</td>
                                                <td>
                                                    <div class="progress progress-lg">
                                                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 10%" id="qpercent">
                                                            <span class="sr-only">40% Complete (success)</span>
                                                        </div>
                                                    </div>
                                                </td>
                                                <td>
                                                    <a class="btn btn-primary btn-sm">查看报告</a>
                                                    <a class="btn btn-primary btn-sm">下载pdf</a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

            </div>
            <div class="modal-footer" >
                <a class="btn btn-default">关闭</a>
            </div>
        </div>

    </div>
</div>


<!-- 添加用户对话框 -->
<div class="modal fade" id="add-user" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-keyboard="false">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                添加用户<a id="add-user-classinfo" style="display: none;">all</a>
            </div>
            <div class="modal-body" >
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-body">
                            <form role="form">
                                <div class="form-group">
                                    <table class="table">
                                        <thead>
                                        <tr>
                                            <td>用户名</td>
                                            <td>密码</td>
                                            <td>邮箱</td>
                                            <td>年龄</td>
                                            <td>性别</td>
                                        </tr>
                                        </thead>
                                        <tbody id="add-user-tbody">
                                        <tr>
                                            <td><input class="form-control" type="text" id="add-username" /></td>
                                            <td><input class="form-control" type="text" id="add-userpasswd"/></td>
                                            <td><input class="form-control" type="email" id="add-useremail"/></td>
                                            <td ><input class="form-control" type="number" id="add-userage"/></td>
                                            <td><input type="radio" name="sex" value="男" class="add-usersex" checked>男
                                                <input type="radio" name="sex" value="女" class="add-usersex">女</td>

                                            <td><a class="btn btn-success" id="add-user-newrow">添加一行</a></td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

            </div>
            <div class="modal-footer" >
                <a class="btn btn-success" id="add-user-save">保存</a>


            </div>
        </div>

    </div>
</div>


<!-- 编辑用户信息对话框 -->
<div class="modal fade" id="edit-user" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-keyboard="false">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                编辑用户<a id="edit-uid" style="display: none;"></a>
            </div>
            <div class="modal-body" >
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-body">
                            <form role="form">
                                <div class="form-group">
                                    <label for="edit-username">修改用户名</label>
                                    <input type="text" class="form-control" placeholder="修改用户名" id="edit-username">
                                    <label for="edit-useremail">修改邮箱</label>
                                    <input type="email" class="form-control" placeholder="修改用户名" id="edit-useremail">
                                    <label for="edit-userpassword">重置密码</label>
                                    <input type="email" class="form-control" placeholder="修改用户名" id="edit-userpassword">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

            </div>
            <div class="modal-footer" >
                <a class="btn btn-success" id="edit-user-save">保存</a>

                <a id="row_username" style="display: none;"></a>
                <a id="row_useremail" style="display: none;"></a>

            </div>
        </div>

    </div>
</div>


<include file="Common/footer" />
<script src="__PUBLIC__/asset/vendor/jquery.nestableNoDrag.js"></script>
<script src="__PUBLIC__/asset/vendor/jquery.sortable.js"></script>
<script src="__PUBLIC__/asset/vendor/bootstrap-table/bootstrap-table.min.js"></script>
<script src="__PUBLIC__/js/tableTools.js"></script>
<script src="__PUBLIC__/js/orgnizerUserClass.js"></script>
<script src="__PUBLIC__/js/orgnizerQuizStatus.js"></script>


<script>
//    function showQuizList()
//    {
//        $.ajax({
//            url:"__URL__/show_TempQuizList",
//            dataType:"json",
//            type:"POST",
//            success:function(data){
//                if (data){
//
//                    var htmls = [];
//
//                    console.log(data);
//
//                    for(var i=0; i < data.length; i++){
//
//                        htmls.push('<tr>')
//                        htmls.push('<td>'+ data[i].quiz_id+'</td>');
//                        htmls.push('<td>'+ data[i].quiz_key+'</td>');
//                        htmls.push('<td>'+''+'</td>');
//                        htmls.push('<td>__URL__'+ data[i].quiz_key+'</td>');
//                        htmls.push('</tr>');
//                    }
//
//
//                    $("#quizlist_tbody").html(htmls.join(''));
//
//                }
//            },
//            error:function(jqXHR){
//                alert("提交错误"+jqXHR.status);
//            }
//        })
//    }


    $(document).ready(function(){
        $(".main-navigation ul").find('li').removeClass('active');
        $(".main-navigation ul").find('li:eq(3)').addClass('active');
        orgnizerUserData("/Home");
        orgnizerQuizStatus("/Home");
       // showQuizList();
//        $("#generate_quiz").click(function(){
//            $.ajax({
//                url:"__URL__/generate_quiz",
//                dataType:"json",
//                type:"POST",
//                data:{
//                    quiz_num:$("#quiz_num").val(),
//                    quiz_type:"16pf"
//                },
//                success:function(data){
//                    if (data.code == 1){
//                        alert(data.msg);
//                    }
//                    else{
//                        alert(data.msg);
//                    }
//                },
//                error:function(jqXHR){
//                    alert("提交错误"+jqXHR.status);
//                }
//            })
//        });
//
//        $("#show-group-report").click(function(){
//            window.location = "/Home/Orgnizer/show_16pf_groupreport/quiztitle/"+$("#quiz_title_select").val()
//        })


    });



</script>